﻿using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Reflection;
using System.Collections.Generic;


class MyTcpListener
{
    public static void Main()
    {
        TcpClient client = new TcpClient("localhost", 13000);

        Console.WriteLine("Введите метод для вызова");
        string message = Console.ReadLine();

        Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
        NetworkStream stream = client.GetStream();
        stream.Write(data, 0, data.Length);
        Console.WriteLine("Отправлено:{0}", message);

        data = new Byte[256];
        String responseData = String.Empty;
        Int32 bytes = stream.Read(data, 0, data.Length);
        responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
        Console.WriteLine("Получено: {0}", responseData);

        stream.Close();
        client.Close();

        Console.ReadLine();
    }
}